Accessing Values in a Structure
Members within a structure may be referred to directly using the . (structure member) operator. This operator is used in conjunction with the structure name and the member name you intend to reference in the form:
<structure name>.<member name>
This format, also known as “dot notation,” gives you direct access to the value within the specified member. This type of structure member reference can be used in place of any simple variable to retrieve or assign values:
 
This notation can also be used when comparing values or when passing values to VectorScript or user-defined functions:
 
Arrays of structures also support the use of dot notation to reference individual structure members:
 
The reference to a member of a structure in an array element is created by appending the member operator and the member name to an array element reference.
As mentioned before, structures support the use of static arrays as data members. Arrays within structures present a bit more of a syntactical challenge when referencing a member value, but otherwise they are not difficult to use. To reference a value in an array element within a structure, append the member operator and a member array element reference to the structure instance identifier:
 
As with non-member arrays, any expression or constant which resolves to an INTEGER value can be used when indexing the member array element.
It is also possible to have arrays of structures which have arrays as members. Once again, a combination of the member operator with a reference to the desired array element is used to obtain the data value. In this case, array element references will appear on both sides of the member operator. This can lead to some rather interesting looking syntax within a script:
 
These expressions are perfectly valid; however, they do require extra attention to ensure the correct syntax is specified.
Structures containing other structures as members also present an additional layer of complexity when referencing members of the nested structure. The key in this situation is to use member chaining to descend through the data hierarchy to the desired value. For example:
 
POINT = STRUCTURE
x,y : REAL;
CIRCLE = STRUCTURE
ctr : POINT;
radius : REAL;
c1,c2 : CIRCLE;
c2.ctr.y:= c1.ctr.y;
The CIRCLE structure declaration makes use of an instance of the POINT structure to more logically organize data. To reference either the x- or y-component of the POINT instance, chain the members of the nested structures:
 
c2.ctr.y:= c1.ctr.y;
References to the member ctr and its members x and y are chained together using the member operator to reference and access the values in the nested structure. Chaining of members in nested structures can be used repeatedly in scripts to access structure members which may be nested several levels deep.

Structures : Accessing Values in a Structure

Nemetschek NA
Phone: 410.290.5114
Fax: 410.290.8050